//
//  MapGrid.h
//  DiceWar
//
//  Created by Xiao  Feng on 17/6/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#ifndef GAME_GAMEPLAY_HEXMAPGRID_H_
#define GAME_GAMEPLAY_HEXMAPGRID_H_

#include "cocos2d.h"
#include "GameConstants.h"
#include "Player.h"
#include "HexCellCoordinate.h"

class HexMapGrid
{
public:
    HexMapGrid();
    ~HexMapGrid();
    
    HexMapGrid(const HexMapGrid& other);
    HexMapGrid& operator=(const HexMapGrid& other);
    
public:
    enum GridType
    {
        kFight,
        kWall,
        kEmpty,
    };
    
public:
    bool isPlayable() const { return m_type == kFight; }
    bool isOwnedByPlayer(PlayerType player) const;
    
    /** the coordinate of the grid in the hex map
     */
    void setCoordinate(int coordinateX, int coordinateY);
    int getCoordinateX() const { return m_coordinateX; }
    int getCoordinateY() const { return m_coordinateY; } 
    HexCellCoordinate getCoordinate() const;
    
    /** the position of the grid in the screen
     */
    void setPosition(const cocos2d::CCPoint& position);
    cocos2d::CCPoint getPosition() const;
    
    /** the type of the grid, a grid can be used by player or not
     */
    void setType(GridType type) { m_type = type; }
    GridType getType() const { return m_type; }
    
    /** the owner of the grid
     */
    void setPlayerType(PlayerType playerType) { m_playerType = playerType; }
    PlayerType getPlayerType() const { return m_playerType; }
    
    /** the number of dices in the grid
     */
    void setNumDices(int numDices) { m_numDices = numDices; }
    int getNumDices() const { return m_numDices; }
    
private:
    int m_positionX;
    int m_positionY;
    
    int m_coordinateX;
    int m_coordinateY;
    
    int m_numDices;
    GridType m_type;
    PlayerType m_playerType;
};

#endif //GAME_GAMEPLAY_HEXMAPGRID_H_
